﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThaireInvestmentWeb.WcfSerivce;

namespace ThaireInvestmentWeb.Models
{
    public class CouponTableAndAmortizeModel
    {

        public CouponTableAndAmortizeModel()
        {
            AmortizeData = new AmortizeScreenData();
            AmortizeData.AmortizeDetailList = new FixincomesecuritiesAmortizeDetail[0];
            AmortizeData.AmortizeHeader = new FixincomesecuritiesAmortizeHeader();
        }

        public AmortizeScreenData AmortizeData { set; get; }

        public string Symbol
        {
            get
            {
                return AmortizeData.AmortizeHeader.Symbol;
            }
        }


        public string TradeDate
        {
            get
            {
                return AmortizeData.AmortizeHeader.TradeDate.GetValueOrDefault().ToString("dd/MM/yyyy");
            }
        }

        public string MaturityDate
        {
            get
            {
                return AmortizeData.AmortizeHeader.MaturityDate.GetValueOrDefault().ToString("dd/MM/yyyy");
            }
        }

        public string PurchasePrice
        {
            get
            {
                return AmortizeData.AmortizeHeader.BookValue.GetValueOrDefault().ToString("#,##0.00");
            }
        }

        public string FaceValue
        {
            get
            {
                return AmortizeData.AmortizeHeader.ParValue.GetValueOrDefault().ToString("#,##0.00");
            }
        }

        public string YTM
        {
            get
            {
                return AmortizeData.AmortizeHeader.Yield.GetValueOrDefault().ToString("#,##0.00000");
            }
        }

        public string IRRPerDay
        {
            get
            {
                return AmortizeData.AmortizeHeader.IrrPerDay.GetValueOrDefault().ToString("#,##0.00000");
            }
        }

        public string IRRPerDayPercent
        {
            get
            {
                return (AmortizeData.AmortizeHeader.IrrPerDay.GetValueOrDefault()*100).ToString("#,##0.00000");
            }
        }

        public string CouponRate
        {
            get
            {
                return AmortizeData.AmortizeHeader.Coupon.GetValueOrDefault().ToString("#,##0.00000");
            }
        }

        public string DiscountPremium
        {
            get
            {
                return AmortizeData.AmortizeHeader.DiscountPremium.GetValueOrDefault().ToString("#,##0.00");
            }
        }

        public string AI
        {
            get
            {
                return AmortizeData.AmortizeHeader.AI.GetValueOrDefault().ToString("#,##0.00");
            }
        }


        public string GrossPrice
        {
            get
            {
                return AmortizeData.AmortizeHeader.GrossPrice.GetValueOrDefault().ToString("#,##0.00");
            }
        }

        public string CleanPrice
        {
            get
            {
                return AmortizeData.AmortizeHeader.CleanPrice.GetValueOrDefault().ToString("#,##0.00");
            }
        }


        public string BtnExportExcel { set; get; }

    }
}